package com.hdc.sell.converter;

import com.hdc.sell.dataobject.OrderMaster;
import com.hdc.sell.dto.OrderDTO;
import org.springframework.beans.BeanUtils;

import java.util.List;
import java.util.stream.Collectors;

/**
 * @author 郭丽然
 * @program: sell
 * @date 2020/5/19 22:19
 * 功能：
 */
public class OrderMaster2OrderDTOConverter {
    //完成orderMaster到orderDTO的转换
    public static OrderDTO convert(OrderMaster orderMaster) {
        OrderDTO orderDTO =new OrderDTO();
        BeanUtils.copyProperties(orderMaster,orderDTO);
        return orderDTO;
    }
    //完成orderMasterList到orderDTOList的转换
    public static List<OrderDTO> convert(List<OrderMaster> orderMasterList) {
        List<OrderDTO> orderDTOList= orderMasterList.stream().map(e->convert(e)).collect(Collectors.toList());
        return  orderDTOList;
    }
}
